#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

int main()
{
    int m = 0;
    int n = 0;
    scanf("%d %d", &m, &n);
    int i = 0;
    int j = 0;
    int arr1[100][100] = { 0 };
    int arr2[100][100] = { 0 };
    for (i = 0; i < m; i++)
    {
        for (j = 0; j < n; j++)
        {
            scanf("%d", &arr1[i][j]);
        }
    }
    int count = 0;
    for (i = 0; i < m; i++)
    {
        for (j = 0; j < n; j++)
        {
            scanf("%d", &arr2[i][j]);
            if (arr1[i][j] == arr2[i][j])
                count++;
        }
    }
    printf("%.2f", 100.0 * count / (n * m));
    return 0;
}
#include <stdio.h>

int main()
{
    char arr[5] = { 0 };
    int count = 0;
    while (1)
    {
        scanf("%c", &arr[count]);
        if (arr[count] == '\n')
            break;
        else if (arr[count] != ' ')
            count++;
    }
    printf("%d", count);
    return 0;
}